package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.dao.BidSupvisionDao;
import com.chinasi.model.BidSupvision;
import com.chinasi.model.ConsultBasic;
import com.chinasi.model.IntegratorBasic;
import com.chinasi.model.SupervisionBasic;
import com.chinasi.service.BidSupvisionService;

@Service
public class BidSupvisionServiceImpl implements BidSupvisionService {

	/**
	 * BidSupvisionDAO
	 */
	@Autowired
	private BidSupvisionDao bidSupvisionDao;
	
	@Override
	public Pager findRelationBid(String supCode, int currentPage) {
		BidSupvision searchBean = new BidSupvision();
		searchBean.setSupCode(supCode);
		Pager pager = new Pager(bidSupvisionDao.getTotalCount(searchBean),currentPage);
		pager.setData(bidSupvisionDao.findRelationBid(searchBean, pager));
		return pager;
	}
	
	@Override
	public Pager findRelationAgency(SupervisionBasic supervision, int currentPage) {
		Pager pager = new Pager(bidSupvisionDao.getRelationAgencyTotalCount(supervision),currentPage);
		pager.setData(bidSupvisionDao.findRelationAgency(supervision,pager));
		return pager;
	}

	@Override
	public Pager findRelationIntegrator(SupervisionBasic supervision, int currentPage) {
		Pager pager = new Pager(bidSupvisionDao.getRelationIntegratorTotalCount(supervision),currentPage);
		pager.setData(bidSupvisionDao.findRelationIntegrator(supervision,pager));
		return pager;
	}

	@Override
	public Pager findRelationConsumer(SupervisionBasic supervision, int currentPage) {
		Pager pager = new Pager(bidSupvisionDao.getRelationConsumerTotalCount(supervision),currentPage);
		pager.setData(bidSupvisionDao.findRelationConsumer(supervision,pager));
		return pager;
	}

	@Override
	public Pager findRelationConsult(SupervisionBasic supervision, int currentPage) {
		Pager pager = new Pager(bidSupvisionDao.getRelationConsultTotalCount(supervision),currentPage);
		pager.setData(bidSupvisionDao.findRelationConsult(supervision,pager));
		return pager;
	}

	@Override
	public Pager findRelationExpert(SupervisionBasic supervision, int currentPage) {
		Pager pager = new Pager(bidSupvisionDao.getRelationExpertTotalCount(supervision),currentPage);
		pager.setData(bidSupvisionDao.findRelationExpert(supervision,pager));
		return pager;
	}
}
